laravel collection first

30

$first = $msgs->first(); // this does ->take(1) under the hood
collect([1, 2, 3, 4])->first(function ($value, $key) {
    return $value > 2;
});

// 3

Comments

Submit
0 Comments